{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "f318781e-5726-40f7-a927-1310c616bf0b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential_1\"</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1mModel: \"sequential_1\"\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
       "┃<span style=\"font-weight: bold\"> Layer (type)                         </span>┃<span style=\"font-weight: bold\"> Output Shape                </span>┃<span style=\"font-weight: bold\">         Param # </span>┃\n",
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
       "│ flatten_1 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Flatten</span>)                  │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">784</span>)                 │               <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_2 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                      │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>)                 │         <span style=\"color: #00af00; text-decoration-color: #00af00\">100,480</span> │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_3 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                      │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>)                  │           <span style=\"color: #00af00; text-decoration-color: #00af00\">1,290</span> │\n",
       "└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n",
       "</pre>\n"
      ],
      "text/plain": [
       "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
       "┃\u001b[1m \u001b[0m\u001b[1mLayer (type)                        \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape               \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m        Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
       "│ flatten_1 (\u001b[38;5;33mFlatten\u001b[0m)                  │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m784\u001b[0m)                 │               \u001b[38;5;34m0\u001b[0m │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_2 (\u001b[38;5;33mDense\u001b[0m)                      │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m128\u001b[0m)                 │         \u001b[38;5;34m100,480\u001b[0m │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_3 (\u001b[38;5;33mDense\u001b[0m)                      │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m10\u001b[0m)                  │           \u001b[38;5;34m1,290\u001b[0m │\n",
       "└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">101,770</span> (397.54 KB)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Total params: \u001b[0m\u001b[38;5;34m101,770\u001b[0m (397.54 KB)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">101,770</span> (397.54 KB)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m101,770\u001b[0m (397.54 KB)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "mnist=tf.keras.datasets.mnist\n",
    "(x_train,y_train),(x_test,y_test)=mnist.load_data()\n",
    "x_train,x_test=x_train/255.0,x_test/255.0\n",
    "model=tf.keras.models.Sequential()\n",
    "model.add(tf.keras.layers.Flatten(input_shape=(28,28)))\n",
    "model.add(tf.keras.layers.Dense(128,activation='relu'))\n",
    "model.add(tf.keras.layers.Dense(10,activation='softmax'))\n",
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "5e6c7a83-643e-4564-9dfb-98fde6858bf5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m4s\u001b[0m 2ms/step - loss: 0.2577 - sparse_categorical_accuracy: 0.9258\n",
      "Epoch 2/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.1114 - sparse_categorical_accuracy: 0.9670\n",
      "Epoch 3/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.0766 - sparse_categorical_accuracy: 0.9764\n",
      "Epoch 4/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.0587 - sparse_categorical_accuracy: 0.9816\n",
      "Epoch 5/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 2ms/step - loss: 0.0442 - sparse_categorical_accuracy: 0.9864\n",
      "313/313 - 1s - 2ms/step - loss: 0.0763 - sparse_categorical_accuracy: 0.9760\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[0.07632281631231308, 0.9760000109672546]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.compile(loss='sparse_categorical_crossentropy',\n",
    "              optimizer='adam',metrics=['sparse_categorical_accuracy'])\n",
    "model.fit(x_train,y_train,batch_size=32,epochs=5)\n",
    "model.evaluate(x_test,y_test,batch_size=32,verbose=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "9a81e346-5983-49ff-9266-065fddebd7ae",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 42ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 31ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 30ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 30ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 30ms/step\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAACQCAYAAAB3anPqAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAJIpJREFUeJzt3XtUlNX+P/A3d+SSIAiBGZaat/CWgpamoWl6KkMOmie1LEPLLE2z6Gsax5V1osxTWepZWimUlzrmkUQNM9O8pNlBExUVK8UIEjWUq8Pn94c/99mjMzkzzsAw836txVofH55nz57nw8B272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NlTws7K1XKjW758OQYOHIigoCCby6gvrpqXvLw8PP744xg/fjyGDx9uUxn1zdVyk5+fj+DgYNUYAIDGjRsjJiYGR48etaosS9RJg0B3qbX1+eefo2fPnup4ZWWlirdt24bc3FwsWbIEsbGx6NGjB1q2bInx48djxYoVmD59OoCLv+StHUcxN65DrpGbdu3aISgoCLm5uejRo4c6vnnzZsTHx1tVljNxhdxcUlNTg6ysLKfusbGUq+SlqKgIgwcPRvv27V0iL4Br5CY8PBynT59GQUGB+k/OsWPHkJeXh379+llVliXqvEGwcuVKnDt3DitWrMBXX32FZcuWoU+fPkYPZcycORP333+/moqUmZmJ48ePo23bthg2bBj++OMPTJkyBV9++SWAi8tJWmrjxo1Wtdr27duHkJAQl3mO4M+4Qm58fHwwefJkpKamwtPTE61atcLy5cvx9ddfY8OGDRbXxdm4Qm4u2bFjB86dO+e0D3haw1XyMmrUKBQVFWHu3LnYt2+fOh4dHY3o6GiL6+NMXCE3PXr0QEREBPr164ekpCRUVVVh5cqV8PT0REpKisV1sZRDHpUvLy/H2bNnUVhYiICAAKPvGQwGjB49GtOnT8ftt9+OrVu3onv37ipJy5cvR05ODqZOnQoAOHXqFKZPn47HH38cQ4YMwZw5c5CammqUVHNdOdXV1aiurkZBQQF++eUXABcfGDlx4oTRV21tLYqLi5Gfn3/FeNF9992HN9980273pr65Q27S0tLw0ksvYc6cORg8eDA2btyIpUuXon///rbfuDrgDrkBgK+++gphYWFo06aNbTeqjrl6XkpLS5GTk4OqqiokJiaie/fu6mvhwoXXdvMczNVzExQUhK1bt6Jz587IzMzEwoULERERgRUrVqBt27bXdvNMsfvahyKya9cuCQkJkfj4eMnNzRURkcOHD0tCQoKEhYVJRkaG0fnbtm2T6OhomTZtmsybN0/i4+NF5OJSp71795bo6GgpKSkREZHa2lq5/fbbJTU1VUREUlJSJCIiQuLi4q6oR0JCgowbN05uu+02CQoKUmtZm/q6tOb1kSNHHHFLnAZz47yYG+fEvDgv5sa+PETMzKlwgLVr15pd7reoqAje3t4IDw9HZWUl/P39ISJYsWIFWrRoYTT+W1JSop4YXbp0KQoKCvDII48YPVlK1mFunBdz45yYF+fF3NimThsERERE5Jwa3nJ7REREZHdsEBAREREbBERERMQGAREREcGKhYnM7dBE18Yez3QyN45xrblhXhyDnxnnxc+Mc7I0L+whICIiIjYIiIiIiA0CIiIiAhsEREREBDYIiIiICGwQEBEREdggICIiIrBBQERERLBiYSIiewsLC1PxzJkzVTxy5EgV33nnnSr+8ccf66ZiRHY2depUFes/6wsXLlTxmTNnTF67aNEiFZ88edL+lSP6/9hDQERERGwQEBERkYsOGaxdu1bFAwcOVHFCQoKKN2/eXKd1oouuv/56Ff/6668q1tfaNhgMKm7RooWKOWRAziw+Pt7o3zk5OSoODAw0ec3kyZOvWm54eLiKt2/fruJly5ZZW0WykH7P9SGeCRMmqFjfdyEjI0PF//d//6fiX375xVFVdAj2EBAREREbBEREROSiQwZ697MeJyYmqphDBnWnf//+KtaHc3T6MMHs2bNVnJWV5biKEdlR3759jf5tbpjAWhMnTlTxoEGDVPztt9+q+Pjx43Z5LXemD0/u27dPxQEBASo297flb3/7m4obNWqk4gcffFDFFy5csFtdHYU9BERERMQGAREREbnQkEG3bt1UfNttt9VjTQgA7rrrLhWnp6er2Nvb9I+cvkCL/lQvUUPx9ttvG/1bn1Hj6+ur4nbt2qn48mGGq2nVqpWKv/jiCxXfe++9Km5oT7bXp169eqk4OztbxfowgbX0oenHHntMxQsWLLC5zLrCHgIiIiJig4CIiIhcaMigadOmKtYXlaD68cILL6i4U6dOJs85fPiwil9//XWH16mh0n+2b7zxRqPv6d3PevfnqlWrVKx3YerH27dvr+I2bdqo+NChQyaP66+l6927t4r1J69PnTpldJ4+e2Tu3Lkmy2rIKioqjP5tbtEhvTu6cePGKo6NjVXxJ598ouLQ0FCT5dx6660q1nPDIQPL9enTR8XXMkxgzi233GL3Mh2JPQRERETEBgERERGxQUBERERwoWcI9HFMqh9jx45Vsbl8HD16VMX9+vVTMVdaM2/JkiUqHjB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IiIicl3sISAiIiI2CIiIiIgNAiIiIgIbBERERAQ2CIiIiAhsEBARERHYICAiIiKwQUBERERgg4CIiIgA/D9oN3SpoN+XAwAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 5 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    t=np.random.randint(1,10000)\n",
    "    x=tf.reshape(x_test[t],(1,28,28))\n",
    "    y_pred=np.argmax(model.predict(x),axis=1)\n",
    "    plt.subplot(1,5,i+1)\n",
    "    plt.rcParams['font.sans-serif']=['SimHei']\n",
    "    plt.axis(\"off\")\n",
    "    plt.imshow(x_test[t],cmap='gray')\n",
    "    title=\"标签值:\"+str(y_test[t])+\"\\n预测值:\"+str(y_pred[0])\n",
    "    plt.title(title)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "08da01a8-f516-4d4a-ac1c-b5bbe6342081",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
